#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# 1) Validate committer email

EMAIL=$(git config user.email)

if echo $EMAIL | grep -Eq '^.*(@antgroup.com|@alipay.com|@antfinancial-corp.com|@antfin-inc.com|@alibaba-inc.com|@antfin.com)$';
then
    echo "You are using a company email address.";
    echo "Please use your personal or GitHub email address instead.";
    echo "";
    echo "To configure your email for this repository, run:";
    echo "";
    echo "   git config user.email 'your.email@example.org'";
    echo "";
    exit 1;
fi;

# 2) Lint staged files

. .venv/bin/activate

pnpm exec lint-staged
